package br.com.contabilidade.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	
	public static Connection getConnection() throws SQLException{
		
	Connection con = null;
	try {
		Class.forName("org.postgresql.Driver");
		System.out.println("conectado!!");
		con = DriverManager.getConnection("jdbc:postgresql://localhost/Contabilidade","postgres", "postgres");
	} catch (Exception e) {
		throw new SQLException(e);
	}
	return con;
	}
	
	public static void main(String[] args) {
		try {
			new ConnectionFactory().getConnection();
		} catch (SQLException e) {
			System.out.println("deu erro");
			e.printStackTrace();
		}
	}
}
